package com.commpany.servie.basic.tag.business.read.productTagMap.impl;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.commpany.jdq.core.orm.Pagination;
import com.commpany.servie.basic.tag.business.read.productTagMap.ProductTagMapReadManage;
import com.commpany.servie.basic.tag.dao.read.ProductTagMapReadDAO;
import java.util.List;
import lombok.extern.slf4j.Slf4j;
import com.commpany.jdq.core.common.PageResult;
import com.commpany.jdq.core.common.BaseReadManager;
import com.commpany.servie.basic.tag.po.ProductTagMapPO;
@Slf4j
@Service
public class ProductTagMapReadManageImpl extends BaseReadManager<ProductTagMapPO> implements ProductTagMapReadManage {
	@Autowired
	private ProductTagMapReadDAO productTagMapReadDAO;
	
	@Override
    public ProductTagMapPO getProductTagMapService(ProductTagMapPO po){
                 checkParams(po);
         return  productTagMapReadDAO.findById(po);
    }
    @Override
	public PageResult<ProductTagMapPO> selectProductTagMapPageService(ProductTagMapPO po, Pagination page){
	       checkParams(po);
	    page.setLimitStart((page.getPageNo() - 1) * page.getPageSize());
		PageResult<ProductTagMapPO> result = new PageResult<ProductTagMapPO>();
		List<ProductTagMapPO> list = productTagMapReadDAO.findOfPage(po, page);
		int count = productTagMapReadDAO.countOfPage(po);
		result.setList(list);
		result.setTotalSize(count);
		result.copy(page);
		return result;
		
	}
	
    @Override
	public int countProductTagMapService( ProductTagMapPO po ){
	            checkParams(po);
	    return productTagMapReadDAO.countOfPage(po);
	
	}
	
    @Override
	public List<ProductTagMapPO> queryProductTagMapService(ProductTagMapPO po){
	            checkParams(po);
	   return  productTagMapReadDAO.findAll(po);
	}
	
}
	